package com.ajun.util;

import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;

import java.util.Map;


public class JwtUtil {
	private static final String SIGNKEY = "hzit";

	public static String createToken(Map<String,Object> map){
		return Jwts.builder()
				.setClaims(map)
				.signWith(SignatureAlgorithm.HS256, SIGNKEY)
				.compact();
	}

	public static Claims parseToken(String token){
		return Jwts.parser()
				.setSigningKey(SIGNKEY)
				.parseClaimsJws(token)
				.getBody();
	}
}
